# Maintainer: David Runge <dvzrv@archlinux.org>

_name=requests-wsgi-adapter
pkgname=python-requests-wsgi-adapter
pkgver=0.4.1
pkgrel=2
pkgdesc="WSGI Transport Adapter for Requests"
arch=(any)
url="https://github.com/seanbrant/requests-wsgi-adapter"
license=(BSD)
depends=(python-requests)
makedepends=(python-build python-installer python-setuptools python-wheel)
# no tests in sdist tarball: https://github.com/seanbrant/requests-wsgi-adapter/issues/21
# checkdepends=(python-pytest)
source=(
  https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz
  # license file missing in sdist tarball: https://github.com/seanbrant/requests-wsgi-adapter/issues/22
  $pkgname-$pkgver-LICENSE::https://raw.githubusercontent.com/seanbrant/requests-wsgi-adapter/7b33ce210c17bd9707e4b26c2f0ed307424f90b9/LICENSE
)
sha256sums=('5a7709e90abf49d181f6c32aa37794537f725de0f6dd42362bc8c8c90812c878'
            '73e719ac528a2980e7155f2b4af58c711e74dce0659951ef609e25fb9b82658a')
b2sums=('6c495a9af66ac8674b4fa14df4f089f82873159d082d12259fdb3ceece2b95c239115b8557de34dbb07efec861d367562aba4d0bebd12500dbbeb446e05d378c'
        'b43b1cc3352363d78cbc0b6ed37cb41a9a76354130e8b779f72bdb6f74bf8680f6c3773f706c290e0ba9990c55fa716f401952fb4affe28e3e4d05c746d13d92')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

# check() {
#   cd $_name-$pkgver
#   pytest -vv
# }

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 README.rst -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 ../$pkgname-$pkgver-LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
